package com.vf.admin.miaodong.controller.fiwork;

import com.vf.admin.client.service.AppMingxiChongzhiService;
import com.vf.admin.common.BaseController;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppMingxiChongzhi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 充值
 */
@RequestMapping("/manage/app/recharge")
@Controller
public class AppRechargeManageController extends BaseController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private AppMingxiChongzhiService appMingxiChongzhiService;

    /**
     * 查询充值记录列表
     *
     * @return
     */
    @RequestMapping("/list")
    public String selectRechargeList(SplitPageBean splitPage, String userid, String nick, String phone,
                                     String ordernum, String leixing, String orderstatus) {
        try {
            Map<String, Object> paraMap = new HashMap<>();
            paraMap.put("userid", userid);
            paraMap.put("nick", nick);
            paraMap.put("phone", phone);
            paraMap.put("ordernum", ordernum);
            paraMap.put("leixing", leixing);
            paraMap.put("orderstatus", orderstatus);

            List<AppMingxiChongzhi> chongzhis = appMingxiChongzhiService.findList1(paraMap, splitPage);
            for (AppMingxiChongzhi chongzhi : chongzhis) {
                chongzhi.setMoney(chongzhi.getMoney());
            }
            request.setAttribute("list", chongzhis);
            request.setAttribute("splitPage", splitPage);
            request.setAttribute("userid", userid);
            request.setAttribute("nick", nick);
            request.setAttribute("phone", phone);
            request.setAttribute("ordernum", ordernum);
            request.setAttribute("leixing", leixing);
            request.setAttribute("orderstatus", orderstatus);
            return this.sucess("/web/manage/app/recharge/list");
        } catch (Exception e) {
            e.printStackTrace();
            return this.error("系统繁忙");
        }
    }


}
